package tool

import (
	"github.com/tedcy/fdfs_client"
	"log"
)

func UploadFile(filename string) string {
	client, err := fdfs_client.NewClientWithConfig("./config/fastdfs.conf")
	if err != nil {
		log.Printf("new fdfs_client: %v", err)
		return ""
	}
	defer client.Destory()

	fileId, err := client.UploadByFilename(filename)
	if err != nil {
		log.Printf("upload: %v", err)
		return ""
	}
	return fileId
}

